package com.qiwx.pigeon.presenter;

import com.qiwx.pigeon.base.BasePresenter;
import com.qiwx.pigeon.base.IBaseView;
import com.qiwx.pigeon.data.network.ApiManager;
import com.qiwx.pigeon.data.network.BaseListResponse;
import com.qiwx.pigeon.data.network.BaseResponse;
import com.qiwx.pigeon.data.network.ResponseSubscriber;
import com.qiwx.pigeon.data.params.CageParam;
import com.qiwx.pigeon.data.vo.CageBeanVo;
import com.qiwx.pigeon.data.vo.GoOutBean;
import com.qiwx.pigeon.data.vo.pageinfo.PageInfo;
import com.qiwx.pigeon.viewinterface.IGoOutView;
import com.qiwx.pigeon.viewinterface.IWXDView;

import java.lang.ref.WeakReference;

import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * @description
 * @Author qiwx
 * @Date 2020-04-26 09:59
 * 出栏操作
 **/
public class WXDPresenter extends BasePresenter<IWXDView> {

    public WXDPresenter(WeakReference<IWXDView> from) {
        super(from);
    }

    public WXDPresenter(IWXDView from) {
        super(from);
    }

    //出栏记录
    public void queryWXDByPage(CageParam params) {
        ApiManager.getApiServer().queryWXDByPage(params)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ResponseSubscriber<BaseResponse<PageInfo<CageBeanVo>>>(true) {
                    @Override
                    public IBaseView getIView() {
                        return getView();
                    }

                    @Override
                    public void onSuccess(BaseResponse<PageInfo<CageBeanVo>> response) {
                        getView().onWXDSuccess(response.data);


                    }


                });
    }


}
